#ifndef BUTTON_H
#define BUTTON_H


#include <QPushButton>
#include <QToolButton>
#include <QKeyEvent>
#include <QLayout>
#include <QWidget>
#include <QSettings>
#include <QStackedWidget>
#include "pictureviewpage.h"
#include <QGSettings>
#include "defaultgetset.h"
#include <kpressbutton.h>

class Button : public QWidget
{
  Q_OBJECT
public:
    explicit Button(QWidget *parent = 0);
    ~Button();
    void CreatButton();
    QStackedLayout *picStackWidget = nullptr;
    QPushButton *pictureVideo = nullptr;
    QLabel *picture = nullptr;
    QWidget *pictureWrap = nullptr;
    kdk::KPressButton *capture = nullptr;
    kdk::KPressButton *video = nullptr;
    QPushButton *cheese = nullptr;   //拍照 白天主题
    QPushButton *cheese_dark = nullptr; //拍照 黑夜主题
    //QPushButton *picture;
    kdk::KPressButton *burst = nullptr;  //连拍
    QPushButton *scale = nullptr;
    QPushButton *voice = nullptr;
    QPushButton *Setting = nullptr;
    QPushButton *stop = nullptr;
    QPushButton *cheese_video = nullptr; // 录像开始
    kdk::KPressButton *m_videoGrid = nullptr;
    kdk::KPressButton *m_videoDelay = nullptr;
    QPushButton *cheese_stop = nullptr;  // 录像结束
    QPushButton *restore = nullptr;   //恢复
    kdk::KPressButton *delay = nullptr;
    QPushButton *layout = nullptr;
    kdk::KPressButton *mirror = nullptr;
    kdk::KPressButton *grid = nullptr;
    QPushButton *filter = nullptr;
    QLabel *aboutMail_1 = nullptr; //lhl debug

    static bool delay_mode;  //延迟拍照模式
    static bool video_mode;  //录像模式
    static bool video_start; //录像开启
    static bool voice_mode;
    static bool Burst_mode;  //滤镜模式
    static bool picturepage_show; //相册显示
Q_SIGNALS:
    void winHeight();
protected:
    virtual void paintEvent(QPaintEvent *);
    virtual bool eventFilter(QObject *watched, QEvent *event);

public Q_SLOTS:
    void capture_click();
    void video_click();
    void cheese_click();
    void cheese_dark_click();
    void picture_click();
    void stop_click();
    void voice_click();
    void cheese_video_click();
    void cheese_stop_click();
    void restore_click();
    void dealSystemGsettingChange(const QString);
    void albumRightMenu();
    void openDir();
    void openFile();


private:
    QHBoxLayout *switchLayout = nullptr;
    QHBoxLayout *btnLayout = nullptr;
    QStackedLayout *btnContainerLayout = nullptr;
    QHBoxLayout *btnLayout1 = nullptr;
    QWidget *btnWidget1 = nullptr;
    QHBoxLayout *btnLayout2 = nullptr;
    QWidget *btnWidget2 = nullptr;

    QVBoxLayout *vLayout = nullptr;
    QSettings *set = new QSettings;
    QString nowThemeStyle;
    DefaultGetSet *gsettingItem = nullptr;
    QHBoxLayout *picAndButton = nullptr;

    void initConnect();
    void initThemeApt();
};

#endif // BUTTON_H
